# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=netkit-bsd-finger
pkgver=0.17
pkgrel=1
pkgdesc='BSD-finger ported to Linux.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-recon')
url='http://ftp.linux.org.uk/pub/linux/Networking/netkit'
license=('BSD')
depends=('glibc')
source=("http://ftp.linux.org.uk/pub/linux/Networking/netkit/bsd-finger-$pkgver.tar.gz"
        'fix-manpage-typo.patch'
        'finger.socket'
        'finger@.service')
sha512sums=('07570a9a5797579273938ef728f222f483c733e78eb6acb00e2bce9ff9df29aa85ed715872032701c8f67fcbc7cf5501f12dc2b8234c30df7d25f50cc38359b0'
            '6fc884cde49798b2a542ad1d405fb4187703f990076cfb55736e4cca74f2af5479e16520ff7bf8a1cf6225b742b5d5174a5f7420aaf1c701eba2549e4b2679ca'
            '97c867d7c0a989a481553c2f943e80b266aec47c189b1c8aaa8e8e596c2e5498addf0fa6d2300e479285c8e09d47d623a2cf45be1675670c23e5cdabf5126fd4'
            '7077df36c6d6eb677b8f3b4fdc8b5b6e3664e445a5e93ca98123f3ced9bc20fe3fb4e660bf9bbbb618afe3c878d871e8020cda8a09094db298590c8cb862821b')

prepare() {
   cd "bsd-finger-$pkgver"

   patch -p1 -i "$srcdir/fix-manpage-typo.patch"

   sed -i 's@include <sys/time.h>@include <time.h>@' finger/lprint.c
   sed -i 's@include <sys/time.h>@include <time.h>@' finger/sprint.c
}

build() {
   cd "bsd-finger-$pkgver"

   ./configure --prefix=/usr

   make
}

package() {
   cd "bsd-finger-$pkgver"

   install -dm 755 "${pkgdir}"/usr/{bin,share/man/{man1,man8}}

   make INSTALLROOT="$pkgdir" SBINDIR=/usr/bin MANDIR=/usr/share/man install

   install -Dm 644 "$srcdir/finger.socket" \
     "$pkgdir/usr/lib/systemd/system/finger.socket"
   install -Dm 644 "$srcdir/finger@.service" \
     "$pkgdir/usr/lib/systemd/system/finger@.service"
}

